package model

var RepositoryNames = struct { // repositories
	CartItem         string
	Order            string
	OrderDiscount    string
	OrderAdjustment  string
	OrderItem        string
	OrderAddress     string
	OrderPayment     string
	OrderShipment    string
	OrderRefund      string
	AfterSaleRequest string
	CompanyAddress   string
}{
	CartItem:         "CartItem",
	Order:            "Order",
	OrderDiscount:    "OrderDiscount",
	OrderAdjustment:  "OrderAdjustment",
	OrderItem:        "OrderItem",
	OrderAddress:     "OrderAddress",
	OrderPayment:     "OrderPayment",
	OrderShipment:    "OrderShipment",
	OrderRefund:      "OrderRefund",
	AfterSaleRequest: "AfterSale",
	CompanyAddress:   "CompanyAddress",
}

var RepositoryPreloadMap = map[string]map[string]string{
	RepositoryNames.CartItem: {
		"Id":          CartItemColumns.ID,
		"UserId":      CartItemColumns.UserID,
		"SkuId":       CartItemColumns.SkuID,
		"Sku":         CartItemColumns.Sku,
		"SkuImageUrl": CartItemColumns.SkuImageURL,
		"ProductId":   CartItemColumns.ProductID,
		"OrderId":     CartItemColumns.OrderID,
		"Title":       CartItemColumns.Title,
		"Slug":        CartItemColumns.Slug,
		"BrandId":     CartItemColumns.BrandID,
		"BrandTitle":  CartItemColumns.BrandTitle,
		"BrandSlug":   CartItemColumns.BrandSlug,
		"GemPrice":    CartItemColumns.GemPrice,
		"RetailPrice": CartItemColumns.RetailPrice,
		"Quantity":    CartItemColumns.Quantity,
		"Status":      CartItemColumns.Status,
		"Favorable":   CartItemColumns.Favorable,
		"Memo":        CartItemColumns.Memo,
		"PostId":      CartItemColumns.PostID,
		"InviterId":   CartItemColumns.InviterID,
	},
	RepositoryNames.Order: {
		"Id":              OrderColumns.ID,
		"ParentId":        OrderColumns.ParentID,
		"UserId":          OrderColumns.UserID,
		"UserRank":        OrderColumns.UserRank,
		"Buyer":           OrderColumns.Buyer,
		"Sn":              OrderColumns.OrderSN,
		"OrderType":       OrderColumns.OrderType,
		"SourceType":      OrderColumns.SourceType,
		"Quantity":        OrderColumns.Quantity,
		"GemAmount":       OrderColumns.GemAmount,
		"RetailAmount":    OrderColumns.RetailAmount,
		"Freight":         OrderColumns.Freight,
		"DiscountAmount":  OrderColumns.DiscountAmount,
		"AdjustAmount":    OrderColumns.AdjustAmount,
		"ActualAmount":    OrderColumns.ActualAmount,
		"DepositAmount":   OrderColumns.DepositAmount,
		"BalanceAmount":   OrderColumns.BalanceAmount,
		"RemainingAmount": OrderColumns.RemainingAmount,
		"Amount":          OrderColumns.RemainingAmount,
		"RefundAmount":    OrderColumns.RefundAmount,
		"Gems":            OrderColumns.Gems,
		"TradeState":      OrderColumns.TradeState,
		"Remark":          OrderColumns.Remark,
		"CreatedAt":       OrderColumns.CreatedAt,
		"UpdatedAt":       OrderColumns.UpdatedAt,
		"PaidAt":          OrderColumns.PaidAt,
		"ShippedAt":       OrderColumns.ShippedAt,
		"DeliveredAt":     OrderColumns.DeliveredAt,
		"ConfirmedAt":     OrderColumns.ConfirmedAt,
		"ReviewedAt":      OrderColumns.ReviewedAt,
		"FulfilledAt":     OrderColumns.FulfilledAt,
		"ClosedAt":        OrderColumns.ClosedAt,
		"AutoComfirmDays": OrderColumns.AutoComfirmDays,
		"Comments":        OrderColumns.Comments,
		"Growth":          OrderColumns.Growth,
		"Integrals":       OrderColumns.Integrals,
	},
	RepositoryNames.OrderDiscount: {
		"Id":               OrderDiscountColumns.OrderDiscountID,
		"OrderId":          OrderDiscountColumns.OrderID,
		"SkuId":            OrderDiscountColumns.SkuID,
		"ProductId":        OrderDiscountColumns.ProductID,
		"Title":            OrderDiscountColumns.Title,
		"Slug":             OrderDiscountColumns.Slug,
		"ActivityId":       OrderDiscountColumns.ActivityID,
		"ActivityRuleId":   OrderDiscountColumns.ActivityRuleID,
		"CouponTemplateId": OrderDiscountColumns.CouponTemplateID,
		"CouponId":         OrderDiscountColumns.CouponID,
		"GrouponAmount":    OrderDiscountColumns.GrouponAmount,
		"WholesaleAmount":  OrderDiscountColumns.WholesaleAmount,
		"CouponAmount":     OrderDiscountColumns.CouponAmount,
		"ActivityAmount":   OrderDiscountColumns.ActivityAmount,
		"IntegralAmount":   OrderDiscountColumns.IntegralAmount,
		"DiscountAmount":   OrderDiscountColumns.DiscountAmount,
		"Integrals":        OrderDiscountColumns.Integrals,
	},
	RepositoryNames.OrderAdjustment: {
		"Id":      OrderAdjustmentColumns.OrderAdjustmentID,
		"OrderId": OrderAdjustmentColumns.OrderID,
		"Amount":  OrderAdjustmentColumns.Amount,
		"Status":  OrderAdjustmentColumns.Status,
	},
	RepositoryNames.OrderItem: {
		"Id":             OrderItemColumns.OrderItemID,
		"OrderId":        OrderItemColumns.OrderID,
		"ProductCode":    OrderItemColumns.ProductCode,
		"SkuId":          OrderItemColumns.SkuID,
		"SkuCode":        OrderItemColumns.SkuCode,
		"Sku":            OrderItemColumns.Sku,
		"ImageId":        OrderItemColumns.SkuImageID,
		"ImageUrl":       OrderItemColumns.SkuImageURL,
		"ProductId":      OrderItemColumns.ProductID,
		"EntryId":        OrderItemColumns.EntryID,
		"Title":          OrderItemColumns.Title,
		"Slug":           OrderItemColumns.Slug,
		"ProductType":    OrderItemColumns.ProductType,
		"BrandId":        OrderItemColumns.BrandID,
		"BrandTitle":     OrderItemColumns.BrandTitle,
		"BrandSlug":      OrderItemColumns.BrandSlug,
		"GemPrice":       OrderItemColumns.GemPrice,
		"RetailPrice":    OrderItemColumns.RetailPrice,
		"Quantity":       OrderItemColumns.Quantity,
		"Weight":         OrderItemColumns.Weight,
		"TradeState":     OrderItemColumns.TradeState,
		"Status":         OrderItemColumns.Status,
		"GemAmount":      OrderItemColumns.GemAmount,
		"RetailAmount":   OrderItemColumns.RetailAmount,
		"Freight":        OrderItemColumns.Freight,
		"DiscountAmount": OrderItemColumns.DiscountAmount,
		"AdjustAmount":   OrderItemColumns.AdjustAmount,
		"ActualAmount":   OrderItemColumns.ActualAmount,
		"RefundAmount":   OrderItemColumns.RefundAmount,
		"RefundQuantity": OrderItemColumns.RefundQuantity,
		"PostId":         CartItemColumns.PostID,
		"InviterId":      CartItemColumns.InviterID,
	},
	RepositoryNames.OrderAddress: {
		"Id":         OrderAddressColumns.OrderAddressID,
		"OrderId":    OrderAddressColumns.OrderID,
		"UserId":     OrderAddressColumns.UserID,
		"Consignee":  OrderAddressColumns.Consignee,
		"Mobile":     OrderAddressColumns.Mobile,
		"Province":   OrderAddressColumns.Province,
		"City":       OrderAddressColumns.City,
		"District":   OrderAddressColumns.District,
		"Street":     OrderAddressColumns.Street,
		"Address":    OrderAddressColumns.DetailedAddress,
		"PostalCode": OrderAddressColumns.PostalCode,
		"RegionCode": OrderAddressColumns.RegionCode,
		"Label":      OrderAddressColumns.Label,
		"Status":     OrderAddressColumns.Status,
	},
	RepositoryNames.OrderPayment: {
		"Id":            OrderPaymentColumns.OrderPaymentID,
		"OrderId":       OrderPaymentColumns.OrderID,
		"No":            OrderPaymentColumns.No,
		"TransactionID": OrderPaymentColumns.TransactionID,
		"Amount":        OrderPaymentColumns.Amount,
		"Type":          OrderPaymentColumns.Type,
		"Name":          OrderPaymentColumns.Name,
		"Code":          OrderPaymentColumns.Code,
		"Status":        OrderPaymentColumns.Status,
		"PaidAt":        OrderPaymentColumns.PaidAt,
	},
	RepositoryNames.OrderShipment: {
		"Id":        OrderShipmentColumns.OrderShipmentID,
		"OrderId":   OrderShipmentColumns.OrderID,
		"No":        OrderShipmentColumns.No,
		"Type":      OrderShipmentColumns.Type,
		"Name":      OrderShipmentColumns.Name,
		"Code":      OrderShipmentColumns.Code,
		"Status":    OrderShipmentColumns.Status,
		"Result":    OrderShipmentColumns.Result,
		"UpdatedAt": OrderShipmentColumns.UpdatedAt,
	},
	RepositoryNames.OrderRefund: {
		"Id":        OrderRefundColumns.OrderRefundID,
		"OrderId":   OrderRefundColumns.OrderID,
		"PaymentId": OrderRefundColumns.OrderPaymentID,
		"RefundNo":  OrderRefundColumns.RefundNo,
		"RefundID":  OrderRefundColumns.RefundID,
		"Amount":    OrderRefundColumns.Amount,
		"Status":    OrderRefundColumns.Status,
		"RefundAt":  OrderRefundColumns.RefundAt,
	},
	RepositoryNames.AfterSaleRequest: {
		"Id":                 AfterSaleRequestColumns.ID,
		"AfterSalesSn":       AfterSaleRequestColumns.AfterSalesSN,
		"OrderId":            AfterSaleRequestColumns.OrderID,
		"OrderItemId":        AfterSaleRequestColumns.OrderItemID,
		"OrderSn":            AfterSaleRequestColumns.OrderSN,
		"ProductId":          AfterSaleRequestColumns.ProductID,
		"ProductSkuId":       AfterSaleRequestColumns.ProductSkuID,
		"ProductTitle":       AfterSaleRequestColumns.ProductTitle,
		"UserId":             AfterSaleRequestColumns.UserID,
		"Mobile":             AfterSaleRequestColumns.Mobile,
		"WithAddress":        AfterSaleRequestColumns.WithAddress,
		"ReturnAddressId":    AfterSaleRequestColumns.ReturnAddressID,
		"WithAfterSaleImage": AfterSaleRequestColumns.WithAfterSaleImage,
		"AfterSaleType":      AfterSaleRequestColumns.AfterSaleType,
		"RefundType":         AfterSaleRequestColumns.RefundType,
		"ReturnType":         AfterSaleRequestColumns.ReturnType,
		"RefundAmount":       AfterSaleRequestColumns.RefundAmount,
		"RefundDetails":      AfterSaleRequestColumns.RefundDetails,
		"Remark":             AfterSaleRequestColumns.Remark,
		"ExpressSn":          AfterSaleRequestColumns.ExpressSN,
		"ReasonForRefusal":   AfterSaleRequestColumns.ReasonForRefusal,
		"Status":             AfterSaleRequestColumns.Status,
		"DelStatus":          AfterSaleRequestColumns.DelStatus,
		"ProcessTime":        AfterSaleRequestColumns.ProcessTime,
		"CreatedAt":          AfterSaleRequestColumns.CreatedAt,
		"UpdatedAt":          AfterSaleRequestColumns.UpdatedAt,
		"DeletedAt":          AfterSaleRequestColumns.DeletedAt,
	},
	RepositoryNames.CompanyAddress: {
		"Id":             CompanyAddressColumns.ID,
		"AddressDetails": CompanyAddressColumns.AddressDetails,
		"ContactPerson":  CompanyAddressColumns.ContactPerson,
		"Mobile":         CompanyAddressColumns.Mobile,
		"Status":         CompanyAddressColumns.Status,
		"DelStatus":      CompanyAddressColumns.DelStatus,
		"CreatedAt":      CompanyAddressColumns.CreatedAt,
		"UpdatedAt":      CompanyAddressColumns.UpdatedAt,
		"DeletedAt":      CompanyAddressColumns.DeletedAt,
	},
}

var RpcEntityNames = struct { // rpc entities
	CartItem         string
	Order            string
	OrderDiscount    string
	OrderAdjustment  string
	OrderItem        string
	OrderAddress     string
	OrderPayment     string
	OrderShipment    string
	OrderRefund      string
	AfterSaleRequest string
	CompanyAddress   string
}{
	CartItem:         "cartItem",
	Order:            "order",
	OrderDiscount:    "orderDiscount",
	OrderAdjustment:  "orderAdjustment",
	OrderItem:        "orderItem",
	OrderAddress:     "orderAddress",
	OrderPayment:     "orderPayment",
	OrderShipment:    "orderShipment",
	OrderRefund:      "orderRefund",
	AfterSaleRequest: "afterSaleRequest",
	CompanyAddress:   "companyAddress",
}

type ColumnSetting struct {
	Name          string // rpc column name
	RpcEntityName string // sqlboiler repository name
}

var RpcEntityPreloadMap = map[string]map[string]*ColumnSetting{
	RpcEntityNames.CartItem:         map[string]*ColumnSetting{},
	RpcEntityNames.Order:            map[string]*ColumnSetting{},
	RpcEntityNames.OrderDiscount:    map[string]*ColumnSetting{},
	RpcEntityNames.OrderAdjustment:  map[string]*ColumnSetting{},
	RpcEntityNames.OrderItem:        map[string]*ColumnSetting{},
	RpcEntityNames.OrderAddress:     map[string]*ColumnSetting{},
	RpcEntityNames.OrderPayment:     map[string]*ColumnSetting{},
	RpcEntityNames.OrderShipment:    map[string]*ColumnSetting{},
	RpcEntityNames.OrderRefund:      map[string]*ColumnSetting{},
	RpcEntityNames.AfterSaleRequest: map[string]*ColumnSetting{},
	RpcEntityNames.CompanyAddress:   map[string]*ColumnSetting{},
}
